package com.zlsy.thread.synchronizedlearing;

/**
 * @author zhouliang
 * @date 2020/03/19
 *
 * 可重入不要求是同一个类的同一个方法
 **/
public class SynchronizedReentrantTest2 {

    private synchronized void method1() {
        System.out.println("我是方法1");
        method2();
    }

    private synchronized void method2() {
        System.out.println("我是方法2");
    }

    public static void main(String[] args) {
        SynchronizedReentrantTest2 instance = new SynchronizedReentrantTest2();
        instance.method1();
    }
}
